const getLocalIP = () => {
    const os = require('os');
    const osType = os.type(); //系统类型
    const ifaces = os.networkInterfaces(); //网络信息
    let locatIp = '';
    for (let dev in ifaces) {
        if (dev === '以太网' || dev === 'WLAN') {
            for (let j = 0; j < ifaces[dev].length; j++) {
                if (ifaces[dev][j].family === 'IPv4') {
                    locatIp = ifaces[dev][j].address;
                    break;
                }
            }
        }
    }
    return locatIp;
}

module.exports= {
    getLocalIP
}